/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * VentanaInicial.java
 *
 * Created on 05-ago-2010, 13:33:07
 */

package presentacion;
import logica.Comunicacion;

/**
 *
 * @author ricardocasanova
 */
public class VentanaInicial extends javax.swing.JFrame {

    /** Creates new form VentanaInicial */
    public VentanaInicial() {
        initComponents();
        inicializarComponentesPropios();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jTFCargo = new javax.swing.JTextField();
        jTFApellido = new javax.swing.JTextField();
        jTFNombre = new javax.swing.JTextField();
        jCBListaUsuarios = new javax.swing.JComboBox();
        jLListaUsuarios = new javax.swing.JLabel();
        jLNombre = new javax.swing.JLabel();
        jLApellido = new javax.swing.JLabel();
        jLCargo = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setResizable(false);

        jTFCargo.setName("jTFCargo"); // NOI18N

        jTFApellido.setName("jTFApellido"); // NOI18N

        jTFNombre.setName("jTFNombre"); // NOI18N
        jTFNombre.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTFNombreActionPerformed(evt);
            }
        });

        jCBListaUsuarios.setName("jCBListaUsuarios"); // NOI18N
        jCBListaUsuarios.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCBListaUsuariosActionPerformed(evt);
            }
        });

        jLListaUsuarios.setText("Seleccione:");
        jLListaUsuarios.setName("jLListaUsuarios"); // NOI18N

        jLNombre.setText("Nombre:");
        jLNombre.setName("jLNombre"); // NOI18N

        jLApellido.setText("Apellido:");
        jLApellido.setName("jLApellido"); // NOI18N

        jLCargo.setText("Cargo:");
        jLCargo.setName("jLCargo"); // NOI18N

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(jLCargo)
                    .add(jLNombre)
                    .add(jLListaUsuarios)
                    .add(jLApellido))
                .add(28, 28, 28)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jTFCargo, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 162, Short.MAX_VALUE)
                    .add(jTFApellido, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 162, Short.MAX_VALUE)
                    .add(jTFNombre, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 162, Short.MAX_VALUE)
                    .add(jCBListaUsuarios, 0, 162, Short.MAX_VALUE))
                .add(28, 28, 28))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLListaUsuarios)
                    .add(jCBListaUsuarios, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(18, 18, 18)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLNombre)
                    .add(jTFNombre, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(18, 18, 18)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLApellido)
                    .add(jTFApellido, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(18, 18, 18)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLCargo)
                    .add(jTFCargo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-308)/2, (screenSize.height-223)/2, 308, 223);
    }// </editor-fold>//GEN-END:initComponents

    private void jTFNombreActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jTFNombreActionPerformed
    {//GEN-HEADEREND:event_jTFNombreActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jTFNombreActionPerformed

    private void jCBListaUsuariosActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jCBListaUsuariosActionPerformed
    {//GEN-HEADEREND:event_jCBListaUsuariosActionPerformed
        // TODO add your handling code here:
        Comunicacion.obtenerDatosSeleccion(jTFNombre, jTFApellido, jTFCargo, jCBListaUsuarios);
    }//GEN-LAST:event_jCBListaUsuariosActionPerformed

    private void inicializarComponentesPropios()
    {
        Comunicacion.inicializarEstructuras();
        Comunicacion.cargarDatosDeUsuarios(jCBListaUsuarios);
    }

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new VentanaInicial().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JComboBox jCBListaUsuarios;
    private javax.swing.JLabel jLApellido;
    private javax.swing.JLabel jLCargo;
    private javax.swing.JLabel jLListaUsuarios;
    private javax.swing.JLabel jLNombre;
    private javax.swing.JTextField jTFApellido;
    private javax.swing.JTextField jTFCargo;
    private javax.swing.JTextField jTFNombre;
    // End of variables declaration//GEN-END:variables

}
